}),
L.resolveDefault(fs.exec_direct('/usr/libexec/acmesh-dnsinfo.sh'), ''),
L.resolveDefault(fs.stat('/usr/lib/acme/client/dnsapi'), null),
+ L.resolveDefault(fs.lines('/proc/sys/kernel/hostname'), ''),
]);
},
let dnsApiInfoText = data[1];
let apiInfos = dnsapi.parseFile(dnsApiInfoText);
let hasDnsApi = data[2] != null;
+ let hostname = data[3];
+ let systemDomain = _guessDomain(hostname);
let wikiUrl = 'https://github.com/acmesh-official/acme.sh/wiki/';
let wikiInstructionUrl = wikiUrl + 'dnsapi';
let m, s, o;
"The first name will be the subject name, subsequent names will be alt names. " +
"Note that all domain names must point at the router in the global DNS."));
o.datatype = "list(string)";
+ if (systemDomain) {
+ o.default = [systemDomain];
+ }
o.validate = function (section_id, value) {
if (!value) {
return true;
}
});
+function _isFqdn(domain) {
+ // Is not an IP i.e. starts from alphanumeric and has least one dot
+ return /[a-z0-9-]\..*$/.test(domain) && !/[0-9-]\..*$/.test(domain);
+}
+
+function _guessDomain(hostname) {
+ return _isFqdn(hostname) ? hostname : (_isFqdn(window.location.hostname) ? window.location.hostname : '');
+}
+
function _addDnsProviderField(s, apiId, opt, isOptsAlt) {
let desc = '<code>' + opt.Name + '</code> ' + opt.Description;